<?php

/**
 * Classe prenant en charge les requetes SQL de type [DELETE]
 *
 * @category   McCube
 * @package    Db
 * @author     Leiha Sellier <leiha.sellier@gmail.com>
 * @license    http://creativecommons.org/licenses/by/3.0/  CC BY 3.0
 * @link       http://code.google.com/p/mechanics-cubes/
 * @see        http://www.php.net/manual/book.pdo.php
 */
class McCube_Db_Query_Delete extends McCube_Db_Query{

    public function build(){
        $q = 'DELETE FROM '.$this->_table;

        if(!empty($this->_where))
           $q .= ' WHERE '.$this->_where;

        if(!empty($this->_orderBy))
            $q .= ' ORDER BY '.$this->_orderBy;

        if(!empty($this->_limit))
            $q .= ' LIMIT '.$this->_limit;

        return $q.';';
    }
}